<?php
/**
 * Description of siswaKonsultasiForm
 *
 * @author Destiya
 */
class siswaKonsultasiForm extends konsultasiForm {
    public function configure() {
        $this->useFields(array('id_user', 'id_konsultan', 'judul', 'isi'));

        $this->widgetSchema['id_user'] = new sfWidgetFormInputHidden();
        $this->widgetSchema['id_konsultan'] = new sfWidgetFormChoice(array(
            'choices'=>Doctrine_Core::getTable('konsultan')->getKonsultanList(),
            'expanded'=>false,
            'multiple'=>false,
            'label'=>'Pilih Guru'
        ));
        
        $this->widgetSchema['judul'] = new sfWidgetFormInputText();
        $this->widgetSchema['isi'] = new sfWidgetFormTextarea();


        $this->validatorSchema['judul'] = new sfValidatorAnd(array(
            new sfValidatorString(array(
                'trim'=> true, 'min_length'=>4
                ), array('min_length'=>'Judul minimal 4 karakter')
            )
        ), array(), array('required'=>'Judul harus diisi'));

        $this->validatorSchema['isi'] = new sfValidatorAnd(array(
            new sfValidatorString(
                array('trim'=>true, 'min_length'=>4),
                array('min_length'=>'Isi minimal 4 karakter')
            ),
            
        ),
        array(),
        array('required'=>'Isi konsultasi harus diisi'));
    }

    public function setIdUser($value) {
        $this->setDefault('id_user', $value);
    }
}
?>
